package com.banmao.mall.controller.client;

import com.banmao.mall.model.pojo.Topic;
import com.banmao.mall.model.vo.BaseRespVO;
import com.banmao.mall.model.vo.client.topic.TopicDetailVO;
import com.banmao.mall.model.vo.client.topic.TopicListClientVO;
import com.banmao.mall.service.client.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("wx/topic")
public class TopicController {

    @Autowired
    TopicService topicService;

    //获取专题列表
    @RequestMapping("list")
    public BaseRespVO list(int page, int size) {
        TopicListClientVO topicListClientVO = topicService.list(page,size);
        return BaseRespVO.ok(topicListClientVO);
    }

    //获取专题详情
    @RequestMapping("detail")
    public BaseRespVO detail(int id) {
        TopicDetailVO topicDetailVO = topicService.detail(id);
        return BaseRespVO.ok(topicDetailVO);
    }

    //推荐专题
    @RequestMapping("related")
    public BaseRespVO related(int id) {
        List<Topic> topicList = topicService.related(id);
        return BaseRespVO.ok(topicList);
    }

}
